<?php
/**
 * GeryEngine
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this release in the file LICENSE
 *
 * @copyright  Copyright (c) 2007 Arjen Brouwer
 * @license    New BSD License
 * @author     Arjen Brouwer
 */

class ReferenceProxy {
	
	private $context;
	private $rs;
	private $reference;
	
	public function __construct(IGeryContext $context, RuntimeServices $rs, $reference) 
	{
		$this->context = $context;
		$this->rs = $rs;
		$this->reference = $reference;
	}
	
	public function invoke() 
	{
		$return = TemplateReferenceCompiler::evaluateReference($this->context, $this->rs, $this->reference);
		
		if (! $return->evaluated)
			return null;
		
		return $return->value;	
	}
}
?>